package com.boyadegroot.divelog.ui;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.boyadegroot.divelog.data.DiveLogData;
import com.boyadegroot.divelog.models.Diver;
import com.boyadegroot.divelog.ui.diver.DiverPage;

public class DiversAdapter extends FragmentStatePagerAdapter {

    private static final String TAG = DiversAdapter.class.getName();

    private final DiveLogData mData;

    public DiversAdapter(FragmentManager fm, DiveLogData data) {
        super(fm);
        mData = data;
    }

    @Override
    public Fragment getItem(int position) {
        // Log.v(TAG, "getItem(position = " + position + ")");
        Diver diver = mData.getDiverByPosition(position);
        return DiverPage.newInstance(diver);
    }

    @Override
    public int getCount() {
        return mData.getDiversCount();
    }

    @Override
    public int getItemPosition(Object item) {
        return POSITION_NONE;
    }
}
